//
//  HWGameDetailHeader.swift
//  HWanGame
//
//  Created by 王昌健 on 2022/3/14.
//  Copyright © 2022 94Wan. All rights reserved.
//

import UIKit

class HWGameDetailHeader: UITableViewHeaderFooterView {
    var titleLabel:UILabel!
    class func headerOrFooterWithTableView(tableView:UITableView) -> (HWGameDetailHeader) {
        let reUse:String = "HWGameDetailHeader"
        
        var headerOrFooter = tableView.dequeueReusableHeaderFooterView(withIdentifier: reUse)
        
        if headerOrFooter == nil {
            headerOrFooter = HWGameDetailHeader.init(reuseIdentifier: reUse)
        }
        
        return headerOrFooter as! HWGameDetailHeader
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier)
        initUI()
        initFrame()
    }
    
    
    func initUI() -> Void {
        backgroundView = UIView()
//        backgroundColor = UIColor.white
        contentView.backgroundColor = .white
        titleLabel = HWLabel.createBoldLabel(title: "", color: "#333333", font: 16*widthScale)
        contentView.addSubview(titleLabel)
        
    }
    
    func initFrame() -> Void {
        titleLabel.snp.makeConstraints { make in
            make.left.equalTo(15*widthScale)
            make.centerY.equalToSuperview()
        }
    }

}
